package com.asdhawaii.otello.players;

import java.util.List;
import java.util.Random;
import com.asdhawaii.otello.board.Move;
import com.asdhawaii.otello.board.Square;
import com.asdhawaii.otello.board.SquareContents;

/**
 * The lowest level of Otello AI, playing randomly.
 * 
 * @author Branden Ogata
 *
 */

public class Level0Ai extends AbstractOtelloAi
{
  /**
   * Creates a new Level0Ai.
   * 
   * @param color The SquareContents indicating the color of the pieces for the new Level0Ai.
   * 
   */
  
  public Level0Ai(SquareContents color)
  {
    super(color);
  }
  
  /**
   * Returns a random selection from the list of valid moves.
   * 
   * @param board The Square[][] representing the Otello board.
   * @param moves The List<Move> containing the valid moves on the board.
   * 
   * @return A Move representing the selected move.
   * 
   */
  
  @Override
  public Move getMove(Square[][] board, List<Move> moves)
  {
    Random random = new Random();
    return (moves.isEmpty()) ? (null) : (moves.get(random.nextInt(moves.size())));
  }
}
